# GameView
from Tkinter import *
from GameListView import *
from GameInputView import *

from NewGameFrame import *

class GameView(object):
	"""sets up the main window and menu for the program"""
	menu = None
	gameController = None
	tk = None
	
	def __init__(self, rootView):
                """constructor."""
		self.root = rootView;
		self.tk = self.root #compatibility
		self.frame = Frame(self.root, width=300, height=588)
		
		self.listView = GameListView(self.frame, width=300, height=488)
		self.inputView = GameInputView(self.frame, width=300, height=100)
		
		self.listView.grid(row=0)
		self.inputView.grid(row=1)
		
	def getRoot(self):
		"""return the root"""
		return self.root
		
	def getRootInputView(self):
		"""return the input view"""
		return self.inputView
		pass
	
	def setMenu(self,menu):
                """set the menu bar"""
		self.root.config(menu=menu)

	def getListView(self):
		"""return the list view"""
		return self.listView
		
	def set_input_view(self,newInputView):
		"""set the contents of the input view"""
		self.inputView.set_input_view(newInputView)
		
	def set_game_controller(self,controller):
		"""set the game controller for this window"""
		self.gameController = controller
		
	def win(self,winner):
		"""docstring for win"""
		
	def Game_Run_Loop(self):
		"""start main loop"""
		self.root.mainloop()

def InitializeGameView(gameController):
	"""initialize"""
	root = Tk()
	root.title("Mastermind")
	gameView = GameView(root)
	gameView.set_game_controller(gameController)
	gameView.frame.grid(row=0,ipadx=0,ipady=0,padx=0,pady=0)
	
	listView = gameView.getListView()
#	listView.add_row(None, None)
#	listView.add_row(None, None)
#	listView.add_row(None, None)
#	listView.add_row(None, None)
#	listView.add_row(None, None)
#	listView.add_row(None, None)
#	listView.add_row(None, None)
#	listView.add_row(None, None)
#	listView.add_row(None, None)
	
	return gameView

if __name__ == '__main__':
	gv = InitializeGameView(None)
	gv.Game_Run_Loop()
